package org.example.code.test2024.eight_mouth;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class test0720 {


    List<List<Integer>> result = new ArrayList<>();
    LinkedList<Integer> two = new LinkedList<>();
    public List<List<Integer>> permute(int[] nums) {
        fun(nums,0);
        return result;
    }

    private void fun(int[] nums, int x) {
        if(x == nums.length){
            result.add(new ArrayList<>(two));
            return;
        }
        for(int i=0;i<nums.length;i++){
            if(two.contains(nums[i])){
                continue;
            }
            two.add(nums[i]);
            fun(nums,x+1);
            two.removeLast();
        }
    }

}
